import {
    createSlice
} from "@reduxjs/toolkit"

//创建slice
const countSlice = createSlice({
    name: "count",

    initialState: {
        count: 0
    },

    reducers: {
        increment(prev , action){
            prev.count += action.payload
        },
        decrement(prev , action){
            prev.count -= action.payload
        },
    }

})

export default countSlice.reducer

export const {
    increment,
    decrement
} = countSlice.actions